/**
 * Implementacion de la clase MapObject
 */ 
#include "mapObject.hpp"
#include "../config/config.hpp"

MapObject::MapObject(){
    this->height=0;
    this->type=HOTEL;
}

MapObject::MapObject(std::string id, std::string eId, int height, ObjectType type){
	this->setId(id);
	this->setMapElementType(OBJECT);
	//TODO: Ver el tema del posicionamiento en la calle
	this->edgeId = eId;
    this->height = height;
    this->type = type;
	
	std::string source;
	switch(this->type){
		case HOTEL:
			source = Config::getInstance()->get("hotel_image_source");
			break;

		case RESTAURANT:
			source = Config::getInstance()->get("restaurant_image_source");
			break;
		
		case COMISARIA:
			source = Config::getInstance()->get("police_image_source");
			break;

		case ESCUELA:
			source = Config::getInstance()->get("school_image_source");
			break;

		case HOSPITAL:
			source = Config::getInstance()->get("hospital_image_source");
			break;

		default:
			source = Config::getInstance()->get("hospital_image_source");
	}

	this->setImageSource(source);
	this->setImageWidth(31);
	this->setImageHeight(31);
	
}
    
std::string MapObject::getEdgeId(){
	return this->edgeId;
}

int MapObject::getHeight(){
    return this->height;
}

ObjectType MapObject::getType(){
    return this->type;
}

void MapObject::setEdgeId(std::string eId){
	this->edgeId = eId;
}

void MapObject::setHeight(int height){
    this->height = height;
}

void MapObject::setType(ObjectType type){
    this->type = type;
}

bool MapObject::hasSamePosition(MapObject *otherMO){
	if((this->height == otherMO->getHeight())&&(this->edgeId == otherMO->getEdgeId()))
		return true;
	return false;
}

MapObject& MapObject::operator=(MapObject &original){
	this->setId(original.getId());
	this->edgeId = original.getEdgeId();
	this->type = original.getType();
    this->height = original.getHeight();
	return *this;
}